<?php

/**
 * @author blog.anchen8.net
 * @copyright 2012
 */

class ErrorController extends Yaf_Controller_Abstract {
	public function init() {
		//Yaf_Dispatcher::getInstance()->disableView();
	}
	public function errorAction($exception) {
		/* error occurs */
		switch ($exception->getCode()) {
		case YAF_ERR_NOTFOUND_MODULE:
		case YAF_ERR_NOTFOUND_CONTROLLER:
		case YAF_ERR_NOTFOUND_ACTION:
		case YAF_ERR_NOTFOUND_VIEW:
                echo 404, ":", $exception->getMessage();
                $this->display('404');
			break;
        case 1:$message = unserialize($exception->getMessage());
                //echo $message['msg'].' => '.$message['url'];
                $this->_view->assign('message',$message);
                $this->display('success');
            break;
        case 2:$message = unserialize($exception->getMessage());
                //echo $message['msg'].' => '.$message['url'];
                $this->_view->assign('message',$message);
                $this->display('error');
            break;
		default :
			$message = $exception->getMessage();
			echo 0, ":", $exception->getMessage();
            $this->display('404');
			break;
		}
        die();
	}
}

?>